import axios from 'axios';
import {API_NEW_VERSION} from '../api';
var qs = require('qs');
const TAXSHEETS = API_NEW_VERSION + 'taxsheets';
const TAXSHEET = API_NEW_VERSION + 'taxsheet';
const TAXSHEET_BY_ID = API_NEW_VERSION + 'taxsheet/by/id';
const TAXSHEET_SUBMIT = API_NEW_VERSION + 'taxsheet/submit';
const PAYMENT = API_NEW_VERSION + 'payments/';

// 获取我的发票列表
export const searchTaxsheet = params => {
  return axios.get(TAXSHEETS, {params: params});
};
export const saveTaxsheet = (params) => {
  return axios.post(TAXSHEET, params);
};
export const delTaxsheet = id => {
  return axios.delete(TAXSHEET_BY_ID, {params: {id: id}});
};
export const saveTaxsheetSubmit = (params) => {
  return axios.post(TAXSHEET_SUBMIT, params);
};
export const getTaxsheet = id => {
  return axios.get(TAXSHEET_BY_ID, {params: {id: id}});
};
// 税费支付--支付宝支付
export const aliPay = id => {
  return axios.post(API_NEW_VERSION + 'tax/payable/alipay', qs.stringify({taxsheetId: id}));
};
/**
 * 税费支付---账户余额支付
 */
export const accountPay = id => {
  return axios.post(API_NEW_VERSION + 'account/tax/payable', qs.stringify({taxsheetId: id}));
};

/**
 * 税费支付---银联支付
 */
export const unionPay = id => {
  return axios.post(API_NEW_VERSION + 'tax/payable/alipay', qs.stringify({taxsheetId: id}));
};

/**
 * 税费支付---微信支付
 */
export const wechatPay = id => {
  return axios.post(API_NEW_VERSION + 'tax/payable/wechat', qs.stringify({taxsheetId: id}));
};
export const payments = serialNo => {
  return axios.get(PAYMENT + serialNo);
};
